<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>实现找差集功能</title>
	<script type="text/javascript">
		var arr1=[1,3,6,7];
		var arr2=[2,3,6,8];
		function fn(arr1,arr2){
			var arr=[];
			for (var i=0;i<arr1.length;i++) {
				
				if (arr2.indexOf(arr1[i])==-1) {
                  arr.push(arr1[i]);
				}
				if (arr1.indexOf(arr2[i])==-1) {
                  arr.push(arr2[i]);
				}
			}
			console.log(arr);
		}
		fn(arr1,arr2);
	</script>
</head>
<body>
	
</body>
</html>